/** <a href="http://www.cpupk.com/decompiler">Eclipse Class Decompiler</a> plugin, Copyright (c) 2017 Chen Chao. **/
package com.asiainfo.utils.sql.sqlbuilder.select;

class OracleLimiter implements Limiter {
	public Context limit(Context context, int start, int size) {
		Context c = new Context(context);
		c.append("SELECT");
		c.append("data.*");
		c.append("FROM");
		c.append("(");
		c.append("SELECT");
		c.append("ord_data.*,");
		c.append("rownum AS rnum");
		c.append("FROM");
		c.append("(");
		c.append(context.toString());
		c.append(")");
		c.append("ord_data");
		c.append(")");
		c.append("data");
		c.append("WHERE");
		c.append("rnum BETWEEN ? AND ?");
		c.addParameters(new Object[]{Integer.valueOf(start)});
		c.addParameters(new Object[]{Integer.valueOf(start + size)});
		return c;
	}
}